package com.infocollect.project.api.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.infocollect.project.api.entity.TappFromTempEntity;
import com.infocollect.project.api.mapper.TappFromTempMapper;
import com.infocollect.project.api.service.ITappFromTempService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("TappFromTempService")
public class TappFromTempServiceImpl extends ServiceImpl<TappFromTempMapper, TappFromTempEntity> implements ITappFromTempService {

    /**
     * 通过ID查询单条数据
     *
     * @param fid 主键
     * @return 实例对象
     */
    @Override
    public TappFromTempEntity queryById(Long fid) {
        return this.baseMapper.queryById(fid);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<TappFromTempEntity> queryAllByLimit(int offset, int limit) {
        return this.baseMapper.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param tappFrom 实例对象
     * @return 实例对象
     */
    @Override
    public TappFromTempEntity insert(TappFromTempEntity tappFrom) {
        this.baseMapper.insert(tappFrom);
        return tappFrom;
    }

    /**
     * 修改数据
     *
     * @param tappFrom 实例对象
     * @return 实例对象
     */
    @Override
    public TappFromTempEntity update(TappFromTempEntity tappFrom) {
        this.baseMapper.updateById(tappFrom);
        return this.queryById(tappFrom.getFid());
    }

    /**
     * 通过主键删除数据
     *
     * @param fid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long fid) {
        return this.baseMapper.deleteById(fid) > 0;
    }

    /**
     * 查询多条数据
     * @menu 根据实体对象是否有值 进行查询
     * @return 对象列表
     */
    @Override
    public List<TappFromTempEntity> queryAll(TappFromTempEntity entity){
        return this.baseMapper.queryAll(entity) ;
    }

    /**
     * 返回表单设计字段
     * @param fid
     * @return
     */
    @Override
    public String GetFromDesignJson(Long fid){
        return this.baseMapper.GetFromDesignJson(fid) ;
    }

    /**
     * 返回表单默认配置值
     * @param fid
     * @return
     */
    @Override
    public TappFromTempEntity GetDefaultdata(Long fid){
        return this.baseMapper.GetDefaultdata(fid) ;
    }
    /**
     * 返回表单默认配置值
     * @param
     * @return
     */
    @Override
    public List<TappFromTempEntity> querypageList(TappFromTempEntity tappfromtemp){
        return this.baseMapper.querypageList(tappfromtemp) ;
    }
}
